全部文档

4.4物模型服务

提供服务物模型相关的增删改查功能

4.4.1创建服务模型

功能描述:指定产品,为该产品添加一个服务物模型。

POST  /api/v1/service/draft

Body:

Name Type Description Required
productId int 产品ID Yes
identifier string 属性名称(该产品下唯一) Yes
name string 界面显示属性名 Yes
type int 服务类型 Yes
created long 创建时间 No
modified long 修改时间 No
inputValue struct[] 输入参数 No
outputValue struct[] 输出参数 No
description string 描述 No

inputValue和outputValue的子对象结构体:

Name Type Description Required
name string 界面显示属性名 Yes
identifier string 属性名 Yes
type int 数据类型,具体值参考公共能力type类型码表。 Yes
minimum number 最小值 No
maximum number 最大值 No
unit string 属性单位 No
special struct[] 对部分数据类型的补充说明 No

special的子对象结构体:

Name Type Description Required
length int string/bytes类型的字符串长度,1~2048 No(string/bytes类型时必传)
precision number 精度 No
step number 步长, 设备上传数据间隔 No
enumArray struct[] 枚举或布尔类型的相关信息的数组(布尔类型时元素的key有且仅有0/1,枚举类型时元素的个数不超过20个,key范围0~127) No(boolean或enum类型时必传)

enumArray的子对象结构体:

Name Type Description Required
key int 枚举或布尔类型的值(布尔类型时key有且仅有0/1,枚举类型时key范围0~127) Yes
describe string 值对应的说明 Yes

Body example:

{
  "productId": 100124,
  "identifier": "vtest12411",
  "type": 1,
  "name": "vte1st412",
  "inputValue": [
     {
       "name": "vte1s1t",
       "identifier": "vte1st",
       "type": 1,
       "minimum": 0,
       "maximum": 0,
       "unit": "vtest",
       "special": {
         "length": 3
                   }
     }
     ],
  "outputValue": [
     {
       "name": "vtest12",
       "identifier": "vtest12",
       "type": 6,
       "minimum": 0,
       "maximum": 100,
       "unit": "vtest2",
       "special": {
         "step": 0.01
                  }
     }
     ],
  "description": "vtes1t2"
}

cURL example:

curl --location --request POST '{{address}}/api/v1/service/draft?accessKeyId={accessKeyId}&signatureNonce={signatureNonce}&signature={signature}' \
--header 'projectId: {projectId}' \
--header 'platform: 1' \
--header 'Content-Type: application/json' \
--data-raw '{
              "productId": 100124,
              "identifier": "vtest12411",
              "type": 1,
              "name": "vte1st412",
              "inputValue": [
                 {
                   "name": "vte1s1t",
                   "identifier": "vte1st",
                   "type": 1,
                   "minimum": 0,
                   "maximum": 0,
                   "unit": "vtest",
                   "special": {
                     "length": 3
                               }
                 }
                 ],
              "outputValue": [
                 {
                   "name": "vtest12",
                   "identifier": "vtest12",
                   "type": 6,
                   "minimum": 0,
                   "maximum": 100,
                   "unit": "vtest2",
                   "special": {
                     "step": 0.01
                              }
                 }
                 ],
              "description": "vtes1t2"
            }'

Response data:

Name Type Description
id int 服务模型ID
productId int 产品ID
identifier string 属性名称(该产品下唯一)
name string 界面显示属性名
type int 服务类型
created long 创建时间
modified long 修改时间
inputValue struct[] 输入参数
outputValue struct[] 输出参数
description string 描述

inputValue和outputValue的子对象结构体:

Name Type Description
name string 界面显示属性名
identifier string 属性名
type int 数据类型
minimum number 最小值
maximum number 最大值
unit string 属性单位
special struct[] 对部分数据类型的补充说明

special的子对象结构体:

Name Type Description
length int string/bytes类型的字符串长度,1~2048
precision number 精度
step number 步长, 设备上传数据间隔
enumArray struct[] 枚举或布尔类型的相关信息的数组

enumArray的子对象结构体:

Name Type Description
key int 枚举或布尔类型的值(布尔类型时key有且仅有0/1,枚举类型时key范围0~127)
describe string 值对应的说明

Response example:

{
    "code": 0,
    "data": {
        "identifier": "test",
        "productId": 100124,
        "outputValue": [
            {
                "special": {
                    "precision": null,
                    "length": null,
                    "step": 0.01,
                    "enumArray": null
                },
                "identifier": "test",
                "unit": "",
                "name": "vtest12",
                "maximum": 100.0,
                "type": 6,
                "minimum": 0.0
            }
        ],
        "created": 1610614699231,
        "name": "test",
        "inputValue": [
            {
                "special": {
                    "precision": null,
                    "length": 3,
                    "step": null,
                    "enumArray": null
                },
                "identifier": "test",
                "unit": "test",
                "name": "test",
                "maximum": 0.0,
                "type": 1,
                "minimum": 0.0
            }
        ],
        "modified": 1610614699231,
        "description": "test",
        "id": 4299,
        "type": 1
    },
    "msg": "成功",
    "referInfo": null,
    "success": true
}

4.4.2根据服务ID获取服务

功能描述:指定服务,获取该服务具体信息信息。

GET  /api/v1/service/{serviceId}

Path:

Name Type Description Required
serviceId Integer 服务ID Yes

cURL example:

curl --location --request GET '{{address}}/api/v1/service/{serviceId}?accessKeyId={accessKeyId}&signatureNonce={signatureNonce}&signature={signature}'
--header 'platform: 1' \
--header 'projectId: {projectId}'

Response body:

Name Type Description
id int 服务模型ID
productId int 产品ID
identifier string 属性名称(该产品下唯一)
name string 界面显示属性名
type int 服务类型
created long 创建时间
modified long 修改时间
inputValue struct[] 输入参数
outputValue struct[] 输出参数
description string 描述

inputValue和outputValue的子对象结构体:

Name Type Description
name string 界面显示属性名
identifier string 属性名
type int 数据类型
minimum number 最小值
maximum number 最大值
unit string 属性单位
special struct[] 对部分数据类型的补充说明

special的子对象结构体:

Name Type Description
length int string/bytes类型的字符串长度,1~2048
precision number 精度
step number 步长, 设备上传数据间隔
enumArray struct[] 枚举或布尔类型的相关信息的数组

enumArray的子对象结构体:

Name Type Description
key int 枚举或布尔类型的值(布尔类型时key有且仅有0/1,枚举类型时key范围0~127)
describe string 值对应的说明

Response example:

{
    "code": 0,
    "data": {
        "identifier": "test",
        "productId": 100124,
        "outputValue": [
            {
                "special": {
                    "precision": null,
                    "length": null,
                    "step": 0.01,
                    "enumArray": null
                },
                "identifier": "test",
                "unit": "",
                "name": "test",
                "maximum": 100.0,
                "type": 6,
                "minimum": 0.0
            }
        ],
        "created": 1610614699231,
        "name": "test",
        "inputValue": [
            {
                "special": {
                    "precision": null,
                    "length": 3,
                    "step": null,
                    "enumArray": null
                },
                "identifier": "test",
                "unit": "test",
                "name": "test",
                "maximum": 0.0,
                "type": 1,
                "minimum": 0.0
            }
        ],
        "modified": 1610614699231,
        "description": "test",
        "id": 4299,
        "type": 1
    },
    "msg": "成功",
    "referInfo": null,
    "success": true
}

4.4.3根据服务ID获取服务模型

功能描述:指定服务,获取该服务模型具体信息信息。

GET  /api/v1/service/draft/{serviceId}

Path:

Name Type Description Required
serviceId Integer 服务ID Yes

cURL example:

curl --location --request GET '{{address}}/api/v1/service/draft/{serviceId}?accessKeyId={accessKeyId}&signatureNonce={signatureNonce}&signature={signature}'
--header 'platform: 1' \
--header 'projectId: {projectId}'

Response body:

Name Type Description
id int 服务模型ID
productId int 产品ID
identifier string 属性名称(该产品下唯一)
name string 界面显示属性名
type int 服务类型
created long 创建时间
modified long 修改时间
inputValue struct[] 输入参数
outputValue struct[] 输出参数
description string 描述

inputValue和outputValue的子对象结构体:

Name Type Description
name string 界面显示属性名
identifier string 属性名
type int 数据类型
minimum number 最小值
maximum number 最大值
unit string 属性单位
special struct[] 对部分数据类型的补充说明

special的子对象结构体:

Name Type Description
length int string/bytes类型的字符串长度,1~2048
precision number 精度
step number 步长, 设备上传数据间隔
enumArray struct[] 枚举或布尔类型的相关信息的数组

enumArray的子对象结构体:

Name Type Description
key int 枚举或布尔类型的值(布尔类型时key有且仅有0/1,枚举类型时key范围0~127)
describe string 值对应的说明

Response example:

{
    "code": 0,
    "data": {
        "identifier": "test",
        "productId": 100124,
        "outputValue": [
            {
                "special": {
                    "precision": null,
                    "length": null,
                    "step": 0.01,
                    "enumArray": null
                },
                "identifier": "test",
                "unit": "",
                "name": "test",
                "maximum": 100.0,
                "type": 6,
                "minimum": 0.0
            }
        ],
        "created": 1610614699231,
        "name": "test",
        "inputValue": [
            {
                "special": {
                    "precision": null,
                    "length": 3,
                    "step": null,
                    "enumArray": null
                },
                "identifier": "test",
                "unit": "test",
                "name": "test",
                "maximum": 0.0,
                "type": 1,
                "minimum": 0.0
            }
        ],
        "modified": 1610614699231,
        "description": "test",
        "id": 4299,
        "type": 1
    },
    "msg": "成功",
    "referInfo": null,
    "success": true
}

4.4.4根据服务ID删除服务模型

功能描述:指定服务ID,删除该服务模型信息。

DELETE  /api/v1/service/draft/{serviceId}

Path:

Name Type Description Required
serviceId Integer 服务ID Yes

cURL example:

curl --location --request DELETE '{{address}}/api/v1/service/draft/{serviceId}?accessKeyId={accessKeyId}&signatureNonce={signatureNonce}&signature={signature}'
--header 'platform: 1' \
--header 'projectId: {projectId}'

Response example:

{
    "code": 0,
    "data": {
        "rowsAffected": 1
    },
    "msg": "成功",
    "referInfo": null,
    "success": true
}

4.4.5分页查询服务列表信息

功能描述:根据产品ID查询服务信息, 返回产品的服务详细信息列表。

GET  /api/v1/service/page

Query:

Name Type Description Required
product int 产品ID Yes
pageSize int 分页大小 Yes
currentPage int 页码 Yes

cURL example:

curl --location --request GET '{{address}}/api/v1/service/page?accessKeyId={accessKeyId}&signatureNonce={signatureNonce}&signature={signature}&product={product}&pageSize=10&currentPage=1'
--header 'platform: 1' \
--header 'projectId: {projectId}'

Response body:

Name Type Description
id int 服务模型ID
productId int 产品ID
identifier string 属性名称(该产品下唯一)
name string 界面显示属性名
type int 服务类型
created long 创建时间
modified long 修改时间
inputValue struct[] 输入参数
outputValue struct[] 输出参数
description string 描述

inputValue和outputValue的子对象结构体:

Name Type Description
name string 界面显示属性名
identifier string 属性名
type int 数据类型
minimum number 最小值
maximum number 最大值
unit string 属性单位
special struct[] 对部分数据类型的补充说明

special的子对象结构体:

Name Type Description
length int string/bytes类型的字符串长度,1~2048
precision number 精度
step number 步长, 设备上传数据间隔
enumArray struct[] 枚举或布尔类型的相关信息的数组

enumArray的子对象结构体:

Name Type Description
key int 枚举或布尔类型的值(布尔类型时key有且仅有0/1,枚举类型时key范围0~127)
describe string 值对应的说明

Response example:

{
    "code": 0,
    "data": {
        "totalPage": 1,
        "pageSize": 50,
        "currentPage": 1,
        "totalCount": 1,
        "content": [
            {
                "identifier": "test",
                "productId": 100124,
                "outputValue": [
                    {
                        "special": {
                            "precision": null,
                            "length": null,
                            "step": 0.01,
                            "enumArray": null
                        },
                        "identifier": "test",
                        "unit": "test",
                        "name": "test",
                        "maximum": 100.0,
                        "type": 6,
                        "minimum": 0.0
                    }
                ],
                "created": 1610679883463,
                "name": "test",
                "inputValue": [
                    {
                        "special": {
                            "precision": null,
                            "length": 3,
                            "step": null,
                            "enumArray": null
                        },
                        "identifier": "test",
                        "unit": "test",
                        "name": "test",
                        "maximum": 0.0,
                        "type": 1,
                        "minimum": 0.0
                    }
                ],
                "modified": 1610679883463,
                "description": "test",
                "id": 4304,
                "type": 1
            }
        ]
    },
    "msg": "成功",
    "referInfo": null,
    "success": true
}

4.4.6分页查询服务模型列表信息

功能描述:根据产品ID查询服务信息, 返回产品的服务模型详细信息列表。

GET  /api/v1/service/draft/page

Query:

Name Type Description Required
product int 产品ID Yes
pageSize int 分页大小 Yes
currentPage int 页码 Yes

cURL example:

curl --location --request GET '{{address}}/api/v1/service/draft/page?accessKeyId={accessKeyId}&signatureNonce={signatureNonce}&signature={signature}&product={product}&pageSize=10&currentPage=1'
--header 'platform: 1' \
--header 'projectId: {projectId}'

Response body:

Name Type Description
id int 服务模型ID
productId int 产品ID
identifier string 属性名称(该产品下唯一)
name string 界面显示属性名
type int 服务类型
created long 创建时间
modified long 修改时间
inputValue struct[] 输入参数
outputValue struct[] 输出参数
description string 描述

inputValue和outputValue的子对象结构体:

Name Type Description
name string 界面显示属性名
identifier string 属性名
type int 数据类型
minimum number 最小值
maximum number 最大值
unit string 属性单位
special struct[] 对部分数据类型的补充说明

special的子对象结构体:

Name Type Description
length int string/bytes类型的字符串长度,1~2048
precision number 精度
step number 步长, 设备上传数据间隔
enumArray struct[] 枚举或布尔类型的相关信息的数组

enumArray的子对象结构体:

Name Type Description
key int 枚举或布尔类型的值(布尔类型时key有且仅有0/1,枚举类型时key范围0~127)
describe string 值对应的说明

Response example:

{
    "code": 0,
    "data": {
        "totalPage": 1,
        "pageSize": 50,
        "currentPage": 1,
        "totalCount": 1,
        "content": [
            {
                "identifier": "test",
                "productId": 100124,
                "outputValue": [
                    {
                        "special": {
                            "precision": null,
                            "length": null,
                            "step": 0.01,
                            "enumArray": null
                        },
                        "identifier": "test",
                        "unit": "test",
                        "name": "test",
                        "maximum": 100.0,
                        "type": 6,
                        "minimum": 0.0
                    }
                ],
                "created": 1610679883463,
                "name": "test",
                "inputValue": [
                    {
                        "special": {
                            "precision": null,
                            "length": 3,
                            "step": null,
                            "enumArray": null
                        },
                        "identifier": "test",
                        "unit": "test",
                        "name": "test",
                        "maximum": 0.0,
                        "type": 1,
                        "minimum": 0.0
                    }
                ],
                "modified": 1610679883463,
                "description": "test",
                "id": 4304,
                "type": 1
            }
        ]
    },
    "msg": "成功",
    "referInfo": null,
    "success": true
}

4.4.7根据产品ID列表获取服务信息

功能描述:根据产品ID列表批量查询服务信息, 返回产品服务的详细信息列表。

GET  /api/v1/service/multi

Body:

Name Type Description Required
productIdList int[] 产品ID Yes

Body example:

{
  "productIdList": [100124,100127]
}

cURL example:

curl --location --request GET '{{address}}/api/v1/service/multi?accessKeyId={accessKeyId}&signatureNonce={signatureNonce}&signature={signature}'
--header 'platform: 1' \
--header 'projectId: {projectId}' \
--header 'Content-Type: application/json' \
--data-raw '{
              "productIdList": [100124,100127]
            }'

Response body:

Name Type Description
id int 服务模型ID
productId int 产品ID
identifier string 属性名称(该产品下唯一)
name string 界面显示属性名
type int 服务类型
created long 创建时间
modified long 修改时间
inputValue struct[] 输入参数
outputValue struct[] 输出参数
description string 描述

inputValue和outputValue的子对象结构体:

Name Type Description
name string 界面显示属性名
identifier string 属性名
type int 数据类型
minimum number 最小值
maximum number 最大值
unit string 属性单位
special struct[] 对部分数据类型的补充说明

special的子对象结构体:

Name Type Description
length int string/bytes类型的字符串长度,1~2048
precision number 精度
step number 步长, 设备上传数据间隔
enumArray struct[] 枚举或布尔类型的相关信息的数组

enumArray的子对象结构体:

Name Type Description
key int 枚举或布尔类型的值(布尔类型时key有且仅有0/1,枚举类型时key范围0~127)
describe string 值对应的说明

Response example:

{
    "code": 0,
    "data": [
        {
            "identifier": "test",
            "productId": 100127,
            "outputValue": [
                {
                    "special": {
                        "precision": null,
                        "length": null,
                        "step": 0.01,
                        "enumArray": null
                    },
                    "identifier": "test",
                    "unit": "test",
                    "name": "test",
                    "maximum": 100.0,
                    "type": 6,
                    "minimum": 0.0
                }
            ],
            "created": 1610694374183,
            "name": "test",
            "inputValue": [
                {
                    "special": {
                        "precision": null,
                        "length": 3,
                        "step": null,
                        "enumArray": null
                    },
                    "identifier": "test",
                    "unit": "test",
                    "name": "test",
                    "maximum": 0.0,
                    "type": 1,
                    "minimum": 0.0
                }
            ],
            "modified": 1610694374183,
            "description": "test",
            "id": 4305,
            "type": 1
        }
    ],
    "msg": "成功",
    "referInfo": null,
    "success": true
}

4.4.8根据产品ID列表获取服务模型信息

功能描述:根据产品ID列表批量查询服务模型信息, 返回产品服务模型的详细信息列表。

GET  /api/v1/service/draft/multi

Body:

Name Type Description Required
productIdList int[] 产品ID Yes

Body example:

{
  "productIdList": [100124,100127]
}

cURL example:

curl --location --request GET '{{address}}/api/v1/service/draft/multi?accessKeyId={accessKeyId}&signatureNonce={signatureNonce}&signature={signature}'
--header 'platform: 1' \
--header 'projectId: {projectId}' \
--header 'Content-Type: application/json' \
--data-raw '{
              "productIdList": [100124,100127]
            }'

Response body:

Name Type Description
id int 服务模型ID
productId int 产品ID
identifier string 属性名称(该产品下唯一)
name string 界面显示属性名
type int 服务类型
created long 创建时间
modified long 修改时间
inputValue struct[] 输入参数
outputValue struct[] 输出参数
description string 描述

inputValue和outputValue的子对象结构体:

Name Type Description
name string 界面显示属性名
identifier string 属性名
type int 数据类型
minimum number 最小值
maximum number 最大值
unit string 属性单位
special struct[] 对部分数据类型的补充说明

special的子对象结构体:

Name Type Description
length int string/bytes类型的字符串长度,1~2048
precision number 精度
step number 步长, 设备上传数据间隔
enumArray struct[] 枚举或布尔类型的相关信息的数组

enumArray的子对象结构体:

Name Type Description
key int 枚举或布尔类型的值(布尔类型时key有且仅有0/1,枚举类型时key范围0~127)
describe string 值对应的说明

Response example:

{
    "code": 0,
    "data": [
        {
            "identifier": "test",
            "productId": 100127,
            "outputValue": [
                {
                    "special": {
                        "precision": null,
                        "length": null,
                        "step": 0.01,
                        "enumArray": null
                    },
                    "identifier": "test",
                    "unit": "test",
                    "name": "test",
                    "maximum": 100.0,
                    "type": 6,
                    "minimum": 0.0
                }
            ],
            "created": 1610694374183,
            "name": "test",
            "inputValue": [
                {
                    "special": {
                        "precision": null,
                        "length": 3,
                        "step": null,
                        "enumArray": null
                    },
                    "identifier": "test",
                    "unit": "test",
                    "name": "test",
                    "maximum": 0.0,
                    "type": 1,
                    "minimum": 0.0
                }
            ],
            "modified": 1610694374183,
            "description": "test",
            "id": 4305,
            "type": 1
        }
    ],
    "msg": "成功",
    "referInfo": null,
    "success": true
}

4.4.9根据产品ID发布服务

功能描述:指定产品ID,发布该产品下的所有服务。

POST  /api/v1/service/publish/{productId}

Path:

Name Type Description Required
productId Integer 产品ID Yes

cURL example:

curl --location --request DELETE '{{address}}/api/v1/service/publish/{productId}?accessKeyId={accessKeyId}&signatureNonce={signatureNonce}&signature={signature}'
--header 'platform: 1' \
--header 'projectId: {projectId}'

Response example:

{
    "code": 0,
    "data": {
        "rowsAffected": 1
    },
    "msg": "成功",
    "referInfo": null,
    "success": true
}

4.4.10根据服务ID更新服务模型

功能描述:指定服务ID,更新服务模型信息。

PUT  /api/v1/service/draft

Body:

Name Type Description Required
id int 服务模型ID Yes
name string 界面显示属性名 No
inputValue struct[] 输入参数 No
outputValue struct[] 输出参数 No
description string 描述 No

inputValue和outputValue的子对象结构体:

Name Type Description Required
name string 界面显示属性名 No
identifier string 属性名 No
type int 数据类型,具体值参考公共能力type类型码表。 No
minimum number 最小值 No
maximum number 最大值 No
unit string 属性单位 No
special struct[] 对部分数据类型的补充说明 No

special的子对象结构体:

Name Type Description Required
length int string/bytes类型的字符串长度,1~2048 No(string/bytes类型时必传)
precision number 精度 No
step number 步长, 设备上传数据间隔 No
enumArray struct[] 枚举或布尔类型的相关信息的数组(布尔类型时元素的key有且仅有0/1,枚举类型时元素的个数不超过20个,key范围0~127) No(boolean或enum类型时必传)

enumArray的子对象结构体:

Name Type Description Required
key int 枚举或布尔类型的值(布尔类型时key有且仅有0/1,枚举类型时key范围0~127) No
describe string 值对应的说明 No

cURL example:

curl --location --request PUT '{{address}}/api/v1/service/draft?accessKeyId={accessKeyId}&signatureNonce={signatureNonce}&signature={signature}'
--header 'platform: 1' \
--header 'projectId: {projectId}'

Response example:

{
    "code": 0,
    "data": {
        "rowsAffected": 1
    },
    "msg": "成功",
    "referInfo": null,
    "success": true
}

4.4.11批量创建服务模型

功能描述:指定产品,为该产品批量添加服务模型。

POST  /api/v1/service/draft/multi/{productId}

Body:

Name Type Description Required
productId int 产品ID Yes
identifier string 属性名称(该产品下唯一) Yes
name string 界面显示属性名 Yes
type int 服务类型 Yes
created long 创建时间 No
modified long 修改时间 No
inputValue struct[] 输入参数 No
outputValue struct[] 输出参数 No
description string 描述 No

inputValue和outputValue的子对象结构体:

Name Type Description Required
name string 界面显示属性名 Yes
identifier string 属性名 Yes
type int 数据类型,具体值参考公共能力type类型码表。 Yes
minimum number 最小值 No
maximum number 最大值 No
unit string 属性单位 No
special struct[] 对部分数据类型的补充说明 No

special的子对象结构体:

Name Type Description Required
length int string/bytes类型的字符串长度,1~2048 No(string/bytes类型时必传)
precision number 精度 No
step number 步长, 设备上传数据间隔 No
enumArray struct[] 枚举或布尔类型的相关信息的数组(布尔类型时元素的key有且仅有0/1,枚举类型时元素的个数不超过20个,key范围0~127) No(boolean或enum类型时必传)

enumArray的子对象结构体:

Name Type Description Required
key int 枚举或布尔类型的值(布尔类型时key有且仅有0/1,枚举类型时key范围0~127) Yes
describe string 值对应的说明 Yes

Body example:

[
 {
  "productId": 100124,
  "identifier": "vtest12411",
  "type": 1,
  "name": "vte1st412",
  "inputValue": [
     {
       "name": "vte1s1t",
       "identifier": "vte1st",
       "type": 1,
       "minimum": 0,
       "maximum": 0,
       "unit": "vtest",
       "special": {
         "length": 3
                   }
     }
     ],
  "outputValue": [
     {
       "name": "vtest12",
       "identifier": "vtest12",
       "type": 6,
       "minimum": 0,
       "maximum": 100,
       "unit": "vtest2",
       "special": {
         "step": 0.01
                  }
     }
     ],
  "description": "vtes1t2"
 }
]

cURL example:

curl --location --request POST '{{address}}/api/v1/service/draft/multi/{productId}?accessKeyId={accessKeyId}&signatureNonce={signatureNonce}&signature={signature}' \
--header 'projectId: {projectId}' \
--header 'platform: 1' \
--header 'Content-Type: application/json' \
--data-raw '[
             {
              "productId": 100124,
              "identifier": "vtest12411",
              "type": 1,
              "name": "vte1st412",
              "inputValue": [
                 {
                   "name": "vte1s1t",
                   "identifier": "vte1st",
                   "type": 1,
                   "minimum": 0,
                   "maximum": 0,
                   "unit": "vtest",
                   "special": {
                     "length": 3
                               }
                 }
                 ],
              "outputValue": [
                 {
                   "name": "vtest12",
                   "identifier": "vtest12",
                   "type": 6,
                   "minimum": 0,
                   "maximum": 100,
                   "unit": "vtest2",
                   "special": {
                     "step": 0.01
                              }
                 }
                 ],
              "description": "vtes1t2"
             }
            ]'

Response data:

Name Type Description
id int 服务模型ID
productId int 产品ID
identifier string 属性名称(该产品下唯一)
name string 界面显示属性名
type int 服务类型
created long 创建时间
modified long 修改时间
inputValue struct[] 输入参数
outputValue struct[] 输出参数
description string 描述

inputValue和outputValue的子对象结构体:

Name Type Description
name string 界面显示属性名
identifier string 属性名
type int 数据类型
minimum number 最小值
maximum number 最大值
unit string 属性单位
special struct[] 对部分数据类型的补充说明

special的子对象结构体:

Name Type Description
length int string/bytes类型的字符串长度,1~2048
precision number 精度
step number 步长, 设备上传数据间隔
enumArray struct[] 枚举或布尔类型的相关信息的数组

enumArray的子对象结构体:

Name Type Description
key int 枚举或布尔类型的值(布尔类型时key有且仅有0/1,枚举类型时key范围0~127)
describe string 值对应的说明

Response example:

{
    "code": 0,
    "data": [
        {
            "identifier": "test",
            "productId": 100124,
            "outputValue": [
                {
                    "special": {
                        "precision": null,
                        "length": null,
                        "step": 0.01,
                        "enumArray": null
                    },
                    "identifier": "test",
                    "unit": "",
                    "name": "test",
                    "maximum": 100.0,
                    "type": 6,
                    "minimum": 0.0
                }
            ],
            "created": 0,
            "name": "test",
            "inputValue": [
                {
                    "special": {
                        "precision": null,
                        "length": 3,
                        "step": null,
                        "enumArray": null
                    },
                    "identifier": "test",
                    "unit": "test",
                    "name": "test",
                    "maximum": 0.0,
                    "type": 1,
                    "minimum": 0.0
                }
            ],
            "modified": 0,
            "description": "test",
            "id": 0,
            "type": 1,
            "class": 3
        }
    ],
    "msg": "成功",
    "referInfo": null,
    "success": true
}

results matching ""

    No results matching ""